package com.atguigu.gmall.activity.controller;

import com.atguigu.gmall.activity.service.seckillGoodsService;
import com.atguigu.gmall.model.activity.SeckillGoods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/api/activity/seckill")
@RestController
public class SeckillGoodsController {

    @Autowired
    public seckillGoodsService seckillGoodsService;
    //查询秒杀商品的集合
    @GetMapping("/findAll")
    public List<SeckillGoods> findAll(){
    return seckillGoodsService.findAll();
    }

    //查询一个秒杀商品
    @GetMapping("/findOne/{skuId}")
    public SeckillGoods findOne(@PathVariable Long skuId){
        return seckillGoodsService.findOne(skuId);
    }
}
